package com.googlecode.transmutant;

import java.util.Comparator;

class TypeOrderComparator implements Comparator {
	
	int compare(def step1, def step2) {
		def order1 = 0
		def order2 = 0
		if(step1.class.isAnnotationPresent(Step.class)) {
			order1 = step1.class.getAnnotation(Step.class).order()
		}
		if(step2.class.isAnnotationPresent(Step.class)) {
			order2 = step2.class.getAnnotation(Step.class).order()
		}
		if(order1<order2) {
			return -1
		} else if (order1==order2){
			return 0
		} else {
			return 1
		}
	}
}